<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    // 2021-09-04 21:49:00
    // 2021-09-04 21:49
    // 2021-09-04
    // 21:49:00

    // 2021/09/04 21:49:00
    // 2021/09/04 21:49
    // 2021/09/04

    // 封装一个函数 对时间格式化并输出 => 输出时 指定时间格式?
    // pattern 形参用于接收时间格式
    // function dateFormat(){
        var pattern = "YY-MM-DD hh:mm:ss";
        var date = new Date();

        var year = date.getFullYear();
        var month = date.getMonth()+1;
        var day = date.getDate();

        var hour = date.getHours();
        var minute = date.getMinutes();
        var second = date.getSeconds();

        pattern = pattern.replace("YY",year);  // 被替换后的新字符串 赋值给原来的变量
        pattern = pattern.replace("MM",month);
        pattern = pattern.replace("DD",day);
        pattern = pattern.replace("hh",hour);
        pattern = pattern.replace("mm",minute);
        pattern = pattern.replace("ss",second);
        console.log(pattern);
        
        // 链式操作  本质replace() 方法返回的是:被替换后的新字符串 该字符串依旧可以调用replace方法
        pattern = pattern.replace("YY",year).replace("MM",month).replace("DD",day).replace("hh",hour).replace("mm",minute).replace("ss",second);
        console.log(pattern);


    // }


    var arr = [];
    var list = arr.concat(1,2).concat(3,4).concat(5,6);
    console.log(list);
</script>
</html>